var _contextPath;
var sellerCode="";
var sellerName="";
$(document).ready(function() {
	$("#sellers").autocomplete({
		source : function(request, response) {
			$.ajax({
				url : contextPath + '/iccard/report/getSellers',
				dataType : "json",
				data : {
					maxRows : 10,
					keyword : request.term
				},
				success : function(data) {
					sellerCode = "";
					response($.map(data, function(item) {
						return {
							label : item.label,
							value : item.value
						};
					}));
				}
			});
		},
		minLength : 2,
		select : function(event, ui) {
			sellerName = ui.item.label;
		},
		open : function() {
			$(this).removeClass("ui-corner-all").addClass("ui-corner-top");
		},
		close : function() {
			$(this).removeClass("ui-corner-top").addClass("ui-corner-all");
		}
	});
	doSearch();
});
/**
 */
function doSearch() {
	var s = $('input[name="beginTime"]').val();
	var e = $('input[name="endTime"]').val();
	
	var reportId = $('#settlementExportReportId').val();
	alert("settlementExportReportId="+reportId);
	$("#data_list").datagrid(
			{
				onLoadError : function(data) {
					uppAjaxError(data);
				},
				queryParams : {
					settlementExportReportId : reportId,
					merchantName : sellerName,
					beginTime : s,
					endTime : e
				},
				columns : [ [ {
					field : 'merchantName',
					title : '商家名称',
					align : 'center'
				}, {
					field : 'rechargeableCardSettlementAmount',
					title : '充值卡未结算金额',
					align : 'center'
				}, {
					field : 'comboCardSettlementAmounts',
					title : '套餐卡未结算金额',
					align : 'center'
				}, {
					field : 'rechargeableCardSettlementAmount',
					title : '未结算总金额',
					align : 'center'
				} ] ],
				autoRowHeight : true,
				fitColumns : true,
				pagination : true,
				rownumbers : true,
				singleSelect : true
			});
	
}

